class ApiResult:
    code:int
    msg:str
    data:any

    def __init__(self,code=1,msg="失败",data={}) :
        self.code=code
        self.msg=msg
        self.data=data

    @classmethod
    def success(cls,msg="成功",data={}):
        return ApiResult(code=0,msg=msg,data=data)
    @classmethod
    def error(cls,code=1,msg="失败",data={}):
        return ApiResult(code=code,msg=msg,data=data)

    def toDict(self):
        return {"code":self.code,"msg":self.msg,"data":self.data}